//
//  PicListModel.m
//  News
//
//  Created by xalo on 16/2/27.
//  Copyright © 2016年 News. All rights reserved.
//

#import "PicListModel.h"

@implementation PicListModel


-(void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
    if ([key isEqualToString:@"id"]) {
        
        self.ID =value;
    }
    
    if ([key isEqualToString:@"pics"]) {
        
        NSDictionary *picDic = value;
        
        self.picTemplate = [picDic[@"picTemplate"] integerValue];
        //        [self setValue:picDic[@"total"] forKey:@"total"];
        self.TOLAL = [picDic[@"total"] integerValue];
        
           //遍历数组
        self.list = picDic[@"list"];
        
    }
}

// 归档方法
- (void)encodeWithCoder:(NSCoder *)aCoder {
    
    [aCoder encodeObject:_ID forKey:@"ID"];
    [aCoder encodeObject:_title forKey:@"title"];
    [aCoder encodeObject:_intro forKey:@"intro"];
    [aCoder encodeObject:_category forKey:@"category"];
    [aCoder encodeObject:_link forKey:@"link"];
    [aCoder encodeObject:_comments forKey:@"comments"];
    [aCoder encodeObject:_pic forKey:@"pic"];
    [aCoder encodeInteger:_TOLAL forKey:@"TOLAL"];
    [aCoder encodeInteger:_picTemplate forKey:@"picTemplate"];
    [aCoder encodeInteger:_Total forKey:@"Total"];
    [aCoder encodeObject:_PIK forKey:@"PIK"];
    [aCoder encodeObject:_alt forKey:@"alt"];
    [aCoder encodeObject:_list forKey:@"list"];
    
}

// <没用到> 反归档方法
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {
    
    self = [super init];
    if (self) {
        
        self.ID = [aDecoder decodeObjectForKey:@"ID"];
        self.title = [aDecoder decodeObjectForKey:@"title"];
        self.intro = [aDecoder decodeObjectForKey:@"intro"];
        self.comments = [aDecoder decodeObjectForKey:@"comments"];
        self.category = [aDecoder decodeObjectForKey:@"category"];
        self.link = [aDecoder decodeObjectForKey:@"link"];
        self.list = [aDecoder decodeObjectForKey:@"list"];
        self.alt = [aDecoder decodeObjectForKey:@"alt"];
        self.PIK = [aDecoder decodeObjectForKey:@"PIK"];
        self.pic= [aDecoder decodeObjectForKey:@"pic"];
        self.picTemplate = [aDecoder  decodeIntegerForKey:@"picTemplate"];
        self.Total = [aDecoder decodeIntegerForKey:@"Total"];
        self.TOLAL = [aDecoder decodeIntegerForKey:@"TOLAL"];
        
    }
    return self;
}


@end
